OpenCV:¶
OpenCV is a huge open-source library for computer vision, machine learning, and image processing. OpenCV supports a wide variety of programming languages like Python, C++, Java, etc. It can process images and videos to identify objects, faces, or even the handwriting of a human. When it is integrated with various libraries, such as Numpy which is a highly optimized library for numerical operations, then the number of weapons increases in your Arsenal i.e whatever operations one can do in Numpy can be combined with OpenCV.
In [2]:
pip install opencv-python
Collecting opencv-python
Obtaining dependency information for opencv-python from https://files.pythonhosted.org/packages/c7/ec/9dabb6a9abfdebb3c45b0cc52dec901caafef2b2c7e7d6a839ed86d81e91/opencv_python-4.9.0.80-cp37-abi3-win_amd64.whl.metadata
Downloading opencv_python-4.9.0.80-cp37-abi3-win_amd64.whl.metadata (20 kB)
Requirement already satisfied: numpy>=1.21.2 in c:\users\kani\anaconda3\lib\site-packages (from opencv-python) (1.24.3)
Downloading opencv_python-4.9.0.80-cp37-abi3-win_amd64.whl (38.6 MB)
---------------------------------------- 0.0/38.6 MB ? eta -:--:--
---------------------------------------- 0.0/38.6 MB 1.3 MB/s eta 0:00:31
---------------------------------------- 0.1/38.6 MB 1.2 MB/s eta 0:00:33
---------------------------------------- 0.2/38.6 MB 1.5 MB/s eta 0:00:27
---------------------------------------- 0.3/38.6 MB 1.5 MB/s eta 0:00:26
--------------------------------------- 0.5/38.6 MB 2.1 MB/s eta 0:00:19
- -------------------------------------- 1.0/38.6 MB 3.4 MB/s eta 0:00:11
- -------------------------------------- 1.6/38.6 MB 4.5 MB/s eta 0:00:09
-- ------------------------------------- 2.0/38.6 MB 5.4 MB/s eta 0:00:07
-- ------------------------------------- 2.0/38.6 MB 5.4 MB/s eta 0:00:07
-- ------------------------------------- 2.0/38.6 MB 5.4 MB/s eta 0:00:07
-- ------------------------------------- 2.0/38.6 MB 5.4 MB/s eta 0:00:07
-- ------------------------------------- 2.4/38.6 MB 3.9 MB/s eta 0:00:10
--- ------------------------------------ 3.0/38.6 MB 4.5 MB/s eta 0:00:08
---- ----------------------------------- 4.0/38.6 MB 5.5 MB/s eta 0:00:07
---- ----------------------------------- 4.5/38.6 MB 6.1 MB/s eta 0:00:06
----- ---------------------------------- 4.9/38.6 MB 6.1 MB/s eta 0:00:06
----- ---------------------------------- 4.9/38.6 MB 5.8 MB/s eta 0:00:06
----- ---------------------------------- 4.9/38.6 MB 5.8 MB/s eta 0:00:06
----- ---------------------------------- 4.9/38.6 MB 5.8 MB/s eta 0:00:06
----- ---------------------------------- 5.4/38.6 MB 5.3 MB/s eta 0:00:07
----- ---------------------------------- 5.4/38.6 MB 5.2 MB/s eta 0:00:07
------ --------------------------------- 6.5/38.6 MB 5.8 MB/s eta 0:00:06
------- -------------------------------- 6.9/38.6 MB 5.9 MB/s eta 0:00:06
------- -------------------------------- 7.3/38.6 MB 6.0 MB/s eta 0:00:06
------- -------------------------------- 7.6/38.6 MB 6.0 MB/s eta 0:00:06
------- -------------------------------- 7.6/38.6 MB 6.0 MB/s eta 0:00:06
-------- ------------------------------- 7.9/38.6 MB 5.8 MB/s eta 0:00:06
-------- ------------------------------- 8.4/38.6 MB 6.0 MB/s eta 0:00:06
-------- ------------------------------- 8.4/38.6 MB 6.0 MB/s eta 0:00:06
--------- ------------------------------ 8.8/38.6 MB 5.9 MB/s eta 0:00:06
--------- ------------------------------ 9.0/38.6 MB 5.8 MB/s eta 0:00:06
--------- ------------------------------ 9.2/38.6 MB 5.7 MB/s eta 0:00:06
--------- ------------------------------ 9.3/38.6 MB 5.6 MB/s eta 0:00:06
--------- ------------------------------ 9.5/38.6 MB 5.6 MB/s eta 0:00:06
---------- ----------------------------- 9.7/38.6 MB 5.6 MB/s eta 0:00:06
---------- ----------------------------- 9.9/38.6 MB 5.5 MB/s eta 0:00:06
---------- ----------------------------- 10.1/38.6 MB 5.5 MB/s eta 0:00:06
---------- ----------------------------- 10.2/38.6 MB 5.4 MB/s eta 0:00:06
---------- ----------------------------- 10.3/38.6 MB 5.4 MB/s eta 0:00:06
---------- ----------------------------- 10.6/38.6 MB 5.7 MB/s eta 0:00:05
----------- ---------------------------- 10.7/38.6 MB 5.6 MB/s eta 0:00:05
----------- ---------------------------- 10.8/38.6 MB 5.6 MB/s eta 0:00:05
----------- ---------------------------- 11.0/38.6 MB 5.5 MB/s eta 0:00:06
----------- ---------------------------- 11.1/38.6 MB 5.4 MB/s eta 0:00:06
----------- ---------------------------- 11.2/38.6 MB 5.3 MB/s eta 0:00:06
----------- ---------------------------- 11.3/38.6 MB 5.2 MB/s eta 0:00:06
----------- ---------------------------- 11.5/38.6 MB 5.2 MB/s eta 0:00:06
------------ --------------------------- 11.7/38.6 MB 5.0 MB/s eta 0:00:06
------------ --------------------------- 11.9/38.6 MB 4.8 MB/s eta 0:00:06
------------ --------------------------- 12.0/38.6 MB 4.7 MB/s eta 0:00:06
------------ --------------------------- 12.0/38.6 MB 4.7 MB/s eta 0:00:06
------------ --------------------------- 12.3/38.6 MB 4.5 MB/s eta 0:00:06
------------ --------------------------- 12.4/38.6 MB 4.9 MB/s eta 0:00:06
------------ --------------------------- 12.5/38.6 MB 4.8 MB/s eta 0:00:06
------------- -------------------------- 12.6/38.6 MB 4.7 MB/s eta 0:00:06
------------- -------------------------- 12.7/38.6 MB 4.6 MB/s eta 0:00:06
------------- -------------------------- 12.7/38.6 MB 4.6 MB/s eta 0:00:06
------------- -------------------------- 12.9/38.6 MB 4.4 MB/s eta 0:00:06
------------- -------------------------- 12.9/38.6 MB 4.3 MB/s eta 0:00:06
------------- -------------------------- 13.0/38.6 MB 4.2 MB/s eta 0:00:07
------------- -------------------------- 13.1/38.6 MB 4.1 MB/s eta 0:00:07
------------- -------------------------- 13.1/38.6 MB 4.1 MB/s eta 0:00:07
------------- -------------------------- 13.2/38.6 MB 4.1 MB/s eta 0:00:07
------------- -------------------------- 13.3/38.6 MB 4.0 MB/s eta 0:00:07
------------- -------------------------- 13.4/38.6 MB 3.9 MB/s eta 0:00:07
------------- -------------------------- 13.4/38.6 MB 3.8 MB/s eta 0:00:07
------------- -------------------------- 13.5/38.6 MB 3.8 MB/s eta 0:00:07
-------------- ------------------------- 13.6/38.6 MB 3.7 MB/s eta 0:00:07
-------------- ------------------------- 13.7/38.6 MB 3.7 MB/s eta 0:00:07
-------------- ------------------------- 13.8/38.6 MB 3.6 MB/s eta 0:00:07
-------------- ------------------------- 13.8/38.6 MB 3.5 MB/s eta 0:00:08
-------------- ------------------------- 13.9/38.6 MB 3.5 MB/s eta 0:00:08
-------------- ------------------------- 14.0/38.6 MB 3.4 MB/s eta 0:00:08
-------------- ------------------------- 14.1/38.6 MB 3.4 MB/s eta 0:00:08
-------------- ------------------------- 14.2/38.6 MB 3.3 MB/s eta 0:00:08
-------------- ------------------------- 14.3/38.6 MB 3.3 MB/s eta 0:00:08
-------------- ------------------------- 14.4/38.6 MB 3.2 MB/s eta 0:00:08
-------------- ------------------------- 14.4/38.6 MB 3.1 MB/s eta 0:00:08
--------------- ------------------------ 14.5/38.6 MB 3.1 MB/s eta 0:00:08
--------------- ------------------------ 14.6/38.6 MB 3.0 MB/s eta 0:00:08
--------------- ------------------------ 14.7/38.6 MB 3.0 MB/s eta 0:00:08
--------------- ------------------------ 14.8/38.6 MB 3.0 MB/s eta 0:00:08
--------------- ------------------------ 14.9/38.6 MB 2.9 MB/s eta 0:00:09
--------------- ------------------------ 15.0/38.6 MB 2.9 MB/s eta 0:00:09
--------------- ------------------------ 15.0/38.6 MB 2.9 MB/s eta 0:00:09
--------------- ------------------------ 15.1/38.6 MB 2.9 MB/s eta 0:00:09
--------------- ------------------------ 15.2/38.6 MB 2.9 MB/s eta 0:00:08
--------------- ------------------------ 15.3/38.6 MB 2.9 MB/s eta 0:00:08
--------------- ------------------------ 15.4/38.6 MB 2.9 MB/s eta 0:00:09
---------------- ----------------------- 15.5/38.6 MB 2.8 MB/s eta 0:00:09
---------------- ----------------------- 15.5/38.6 MB 2.8 MB/s eta 0:00:09
---------------- ----------------------- 15.6/38.6 MB 2.8 MB/s eta 0:00:09
---------------- ----------------------- 15.7/38.6 MB 2.8 MB/s eta 0:00:09
---------------- ----------------------- 15.8/38.6 MB 2.8 MB/s eta 0:00:09
---------------- ----------------------- 15.9/38.6 MB 2.7 MB/s eta 0:00:09
---------------- ----------------------- 16.0/38.6 MB 2.7 MB/s eta 0:00:09
---------------- ----------------------- 16.1/38.6 MB 2.7 MB/s eta 0:00:09
---------------- ----------------------- 16.2/38.6 MB 2.6 MB/s eta 0:00:09
---------------- ----------------------- 16.3/38.6 MB 2.6 MB/s eta 0:00:09
---------------- ----------------------- 16.3/38.6 MB 2.5 MB/s eta 0:00:09
----------------- ---------------------- 16.4/38.6 MB 2.5 MB/s eta 0:00:09
----------------- ---------------------- 16.5/38.6 MB 2.5 MB/s eta 0:00:09
----------------- ---------------------- 16.6/38.6 MB 2.5 MB/s eta 0:00:09
----------------- ---------------------- 16.7/38.6 MB 2.4 MB/s eta 0:00:10
----------------- ---------------------- 16.8/38.6 MB 2.4 MB/s eta 0:00:10
----------------- ---------------------- 16.9/38.6 MB 2.4 MB/s eta 0:00:10
----------------- ---------------------- 17.0/38.6 MB 2.4 MB/s eta 0:00:10
----------------- ---------------------- 17.0/38.6 MB 2.3 MB/s eta 0:00:10
----------------- ---------------------- 17.1/38.6 MB 2.3 MB/s eta 0:00:10
----------------- ---------------------- 17.2/38.6 MB 2.3 MB/s eta 0:00:10
----------------- ---------------------- 17.3/38.6 MB 2.3 MB/s eta 0:00:10
------------------ --------------------- 17.4/38.6 MB 2.3 MB/s eta 0:00:10
------------------ --------------------- 17.5/38.6 MB 2.2 MB/s eta 0:00:10
------------------ --------------------- 17.6/38.6 MB 2.2 MB/s eta 0:00:10
------------------ --------------------- 17.7/38.6 MB 2.2 MB/s eta 0:00:10
------------------ --------------------- 17.7/38.6 MB 2.2 MB/s eta 0:00:10
------------------ --------------------- 17.8/38.6 MB 2.2 MB/s eta 0:00:10
------------------ --------------------- 17.9/38.6 MB 2.2 MB/s eta 0:00:10
------------------ --------------------- 18.0/38.6 MB 2.2 MB/s eta 0:00:10
------------------ --------------------- 18.1/38.6 MB 2.2 MB/s eta 0:00:10
------------------ --------------------- 18.2/38.6 MB 2.1 MB/s eta 0:00:10
------------------ --------------------- 18.3/38.6 MB 2.1 MB/s eta 0:00:10
------------------- -------------------- 18.4/38.6 MB 2.1 MB/s eta 0:00:10
------------------- -------------------- 18.4/38.6 MB 2.1 MB/s eta 0:00:10
------------------- -------------------- 18.5/38.6 MB 2.1 MB/s eta 0:00:10
------------------- -------------------- 18.7/38.6 MB 2.1 MB/s eta 0:00:10
------------------- -------------------- 18.8/38.6 MB 2.1 MB/s eta 0:00:10
------------------- -------------------- 18.8/38.6 MB 2.0 MB/s eta 0:00:10
------------------- -------------------- 18.9/38.6 MB 2.0 MB/s eta 0:00:10
------------------- -------------------- 19.0/38.6 MB 2.0 MB/s eta 0:00:10
------------------- -------------------- 19.1/38.6 MB 2.0 MB/s eta 0:00:10
------------------- -------------------- 19.2/38.6 MB 2.0 MB/s eta 0:00:10
------------------- -------------------- 19.3/38.6 MB 2.0 MB/s eta 0:00:10
-------------------- ------------------- 19.4/38.6 MB 2.0 MB/s eta 0:00:10
-------------------- ------------------- 19.5/38.6 MB 2.0 MB/s eta 0:00:10
-------------------- ------------------- 19.6/38.6 MB 2.0 MB/s eta 0:00:10
-------------------- ------------------- 19.7/38.6 MB 1.9 MB/s eta 0:00:10
-------------------- ------------------- 19.8/38.6 MB 1.9 MB/s eta 0:00:10
-------------------- ------------------- 19.9/38.6 MB 1.9 MB/s eta 0:00:10
-------------------- ------------------- 20.0/38.6 MB 1.9 MB/s eta 0:00:10
-------------------- ------------------- 20.1/38.6 MB 1.9 MB/s eta 0:00:10
-------------------- ------------------- 20.2/38.6 MB 1.9 MB/s eta 0:00:10
--------------------- ------------------ 20.3/38.6 MB 1.9 MB/s eta 0:00:10
--------------------- ------------------ 20.4/38.6 MB 1.9 MB/s eta 0:00:10
--------------------- ------------------ 20.5/38.6 MB 1.9 MB/s eta 0:00:10
--------------------- ------------------ 20.6/38.6 MB 1.9 MB/s eta 0:00:10
--------------------- ------------------ 20.7/38.6 MB 1.9 MB/s eta 0:00:10
--------------------- ------------------ 20.8/38.6 MB 1.9 MB/s eta 0:00:10
--------------------- ------------------ 20.9/38.6 MB 1.9 MB/s eta 0:00:10
--------------------- ------------------ 21.0/38.6 MB 1.9 MB/s eta 0:00:10
--------------------- ------------------ 21.1/38.6 MB 1.8 MB/s eta 0:00:10
--------------------- ------------------ 21.2/38.6 MB 1.8 MB/s eta 0:00:10
---------------------- ----------------- 21.3/38.6 MB 1.8 MB/s eta 0:00:10
---------------------- ----------------- 21.4/38.6 MB 1.8 MB/s eta 0:00:10
---------------------- ----------------- 21.5/38.6 MB 1.8 MB/s eta 0:00:10
---------------------- ----------------- 21.6/38.6 MB 1.8 MB/s eta 0:00:10
---------------------- ----------------- 21.7/38.6 MB 1.8 MB/s eta 0:00:10
---------------------- ----------------- 21.8/38.6 MB 1.8 MB/s eta 0:00:10
---------------------- ----------------- 21.9/38.6 MB 1.8 MB/s eta 0:00:10
---------------------- ----------------- 22.0/38.6 MB 1.8 MB/s eta 0:00:10
---------------------- ----------------- 22.2/38.6 MB 1.8 MB/s eta 0:00:10
----------------------- ---------------- 22.3/38.6 MB 1.8 MB/s eta 0:00:09
----------------------- ---------------- 22.4/38.6 MB 1.8 MB/s eta 0:00:09
----------------------- ---------------- 22.5/38.6 MB 1.8 MB/s eta 0:00:09
----------------------- ---------------- 22.6/38.6 MB 1.8 MB/s eta 0:00:09
----------------------- ---------------- 22.7/38.6 MB 1.8 MB/s eta 0:00:09
----------------------- ---------------- 22.9/38.6 MB 1.8 MB/s eta 0:00:09
----------------------- ---------------- 23.0/38.6 MB 1.8 MB/s eta 0:00:09
----------------------- ---------------- 23.1/38.6 MB 1.8 MB/s eta 0:00:09
------------------------ --------------- 23.2/38.6 MB 1.8 MB/s eta 0:00:09
------------------------ --------------- 23.3/38.6 MB 1.8 MB/s eta 0:00:09
------------------------ --------------- 23.4/38.6 MB 1.9 MB/s eta 0:00:09
------------------------ --------------- 23.5/38.6 MB 1.9 MB/s eta 0:00:09
------------------------ --------------- 23.6/38.6 MB 1.9 MB/s eta 0:00:08
------------------------ --------------- 23.7/38.6 MB 1.9 MB/s eta 0:00:08
------------------------ --------------- 23.8/38.6 MB 1.9 MB/s eta 0:00:08
------------------------ --------------- 24.0/38.6 MB 1.9 MB/s eta 0:00:08
------------------------ --------------- 24.1/38.6 MB 1.9 MB/s eta 0:00:08
------------------------- -------------- 24.2/38.6 MB 1.9 MB/s eta 0:00:08
------------------------- -------------- 24.3/38.6 MB 1.9 MB/s eta 0:00:08
------------------------- -------------- 24.4/38.6 MB 1.9 MB/s eta 0:00:08
------------------------- -------------- 24.5/38.6 MB 1.9 MB/s eta 0:00:08
------------------------- -------------- 24.6/38.6 MB 1.9 MB/s eta 0:00:08
------------------------- -------------- 24.8/38.6 MB 1.9 MB/s eta 0:00:08
------------------------- -------------- 24.9/38.6 MB 2.0 MB/s eta 0:00:08
------------------------- -------------- 25.0/38.6 MB 2.0 MB/s eta 0:00:07
-------------------------- ------------- 25.1/38.6 MB 2.0 MB/s eta 0:00:07
-------------------------- ------------- 25.3/38.6 MB 2.0 MB/s eta 0:00:07
-------------------------- ------------- 25.4/38.6 MB 2.0 MB/s eta 0:00:07
-------------------------- ------------- 25.6/38.6 MB 2.0 MB/s eta 0:00:07
-------------------------- ------------- 25.7/38.6 MB 2.0 MB/s eta 0:00:07
-------------------------- ------------- 25.8/38.6 MB 2.0 MB/s eta 0:00:07
-------------------------- ------------- 25.9/38.6 MB 2.0 MB/s eta 0:00:07
-------------------------- ------------- 26.0/38.6 MB 2.0 MB/s eta 0:00:07
--------------------------- ------------ 26.1/38.6 MB 2.0 MB/s eta 0:00:07
--------------------------- ------------ 26.2/38.6 MB 2.0 MB/s eta 0:00:07
--------------------------- ------------ 26.4/38.6 MB 2.1 MB/s eta 0:00:06
--------------------------- ------------ 26.6/38.6 MB 2.1 MB/s eta 0:00:06
--------------------------- ------------ 26.7/38.6 MB 2.1 MB/s eta 0:00:06
--------------------------- ------------ 26.8/38.6 MB 2.1 MB/s eta 0:00:06
--------------------------- ------------ 27.0/38.6 MB 2.1 MB/s eta 0:00:06
---------------------------- ----------- 27.1/38.6 MB 2.1 MB/s eta 0:00:06
---------------------------- ----------- 27.2/38.6 MB 2.1 MB/s eta 0:00:06
---------------------------- ----------- 27.3/38.6 MB 2.1 MB/s eta 0:00:06
---------------------------- ----------- 27.5/38.6 MB 2.1 MB/s eta 0:00:06
---------------------------- ----------- 27.6/38.6 MB 2.1 MB/s eta 0:00:06
---------------------------- ----------- 27.7/38.6 MB 2.1 MB/s eta 0:00:06
---------------------------- ----------- 28.0/38.6 MB 2.2 MB/s eta 0:00:05
----------------------------- ---------- 28.4/38.6 MB 2.2 MB/s eta 0:00:05
----------------------------- ---------- 28.5/38.6 MB 2.2 MB/s eta 0:00:05
----------------------------- ---------- 28.7/38.6 MB 2.2 MB/s eta 0:00:05
----------------------------- ---------- 28.8/38.6 MB 2.2 MB/s eta 0:00:05
----------------------------- ---------- 28.9/38.6 MB 2.2 MB/s eta 0:00:05
------------------------------ --------- 29.0/38.6 MB 2.2 MB/s eta 0:00:05
------------------------------ --------- 29.1/38.6 MB 2.2 MB/s eta 0:00:05
------------------------------ --------- 29.3/38.6 MB 2.2 MB/s eta 0:00:05
------------------------------ --------- 29.4/38.6 MB 2.2 MB/s eta 0:00:05
------------------------------ --------- 29.6/38.6 MB 2.3 MB/s eta 0:00:05
------------------------------ --------- 29.7/38.6 MB 2.3 MB/s eta 0:00:04
------------------------------ --------- 29.8/38.6 MB 2.3 MB/s eta 0:00:04
------------------------------- -------- 30.0/38.6 MB 2.3 MB/s eta 0:00:04
------------------------------- -------- 30.1/38.6 MB 2.3 MB/s eta 0:00:04
------------------------------- -------- 30.2/38.6 MB 2.3 MB/s eta 0:00:04
------------------------------- -------- 30.4/38.6 MB 2.3 MB/s eta 0:00:04
------------------------------- -------- 30.5/38.6 MB 2.3 MB/s eta 0:00:04
------------------------------- -------- 30.7/38.6 MB 2.4 MB/s eta 0:00:04
------------------------------- -------- 30.8/38.6 MB 2.4 MB/s eta 0:00:04
-------------------------------- ------- 31.0/38.6 MB 2.4 MB/s eta 0:00:04
-------------------------------- ------- 31.1/38.6 MB 2.4 MB/s eta 0:00:04
-------------------------------- ------- 31.3/38.6 MB 2.4 MB/s eta 0:00:04
-------------------------------- ------- 31.6/38.6 MB 2.4 MB/s eta 0:00:03
-------------------------------- ------- 31.7/38.6 MB 2.5 MB/s eta 0:00:03
--------------------------------- ------ 31.9/38.6 MB 2.5 MB/s eta 0:00:03
--------------------------------- ------ 32.0/38.6 MB 2.5 MB/s eta 0:00:03
--------------------------------- ------ 32.2/38.6 MB 2.5 MB/s eta 0:00:03
--------------------------------- ------ 32.4/38.6 MB 2.5 MB/s eta 0:00:03
--------------------------------- ------ 32.5/38.6 MB 2.5 MB/s eta 0:00:03
--------------------------------- ------ 32.7/38.6 MB 2.5 MB/s eta 0:00:03
---------------------------------- ----- 32.8/38.6 MB 2.6 MB/s eta 0:00:03
---------------------------------- ----- 33.0/38.6 MB 2.6 MB/s eta 0:00:03
---------------------------------- ----- 33.1/38.6 MB 2.6 MB/s eta 0:00:03
---------------------------------- ----- 33.4/38.6 MB 2.6 MB/s eta 0:00:02
---------------------------------- ----- 33.6/38.6 MB 2.7 MB/s eta 0:00:02
---------------------------------- ----- 33.8/38.6 MB 2.7 MB/s eta 0:00:02
----------------------------------- ---- 34.0/38.6 MB 2.7 MB/s eta 0:00:02
----------------------------------- ---- 34.2/38.6 MB 2.7 MB/s eta 0:00:02
----------------------------------- ---- 34.4/38.6 MB 2.8 MB/s eta 0:00:02
----------------------------------- ---- 34.6/38.6 MB 2.8 MB/s eta 0:00:02
----------------------------------- ---- 34.7/38.6 MB 2.8 MB/s eta 0:00:02
------------------------------------ --- 35.0/38.6 MB 2.8 MB/s eta 0:00:02
------------------------------------ --- 35.2/38.6 MB 2.9 MB/s eta 0:00:02
------------------------------------ --- 35.4/38.6 MB 2.9 MB/s eta 0:00:02
------------------------------------ --- 35.7/38.6 MB 2.9 MB/s eta 0:00:02
------------------------------------- -- 35.9/38.6 MB 2.9 MB/s eta 0:00:01
------------------------------------- -- 36.2/38.6 MB 3.0 MB/s eta 0:00:01
------------------------------------- -- 36.4/38.6 MB 3.0 MB/s eta 0:00:01
------------------------------------- -- 36.7/38.6 MB 3.1 MB/s eta 0:00:01
-------------------------------------- - 37.0/38.6 MB 3.1 MB/s eta 0:00:01
-------------------------------------- - 37.2/38.6 MB 3.2 MB/s eta 0:00:01
-------------------------------------- - 37.4/38.6 MB 3.2 MB/s eta 0:00:01
-------------------------------------- - 37.4/38.6 MB 3.2 MB/s eta 0:00:01
-------------------------------------- - 37.4/38.6 MB 3.1 MB/s eta 0:00:01
-------------------------------------- - 37.6/38.6 MB 3.1 MB/s eta 0:00:01
--------------------------------------- 37.8/38.6 MB 3.2 MB/s eta 0:00:01
--------------------------------------- 38.1/38.6 MB 3.2 MB/s eta 0:00:01
--------------------------------------- 38.4/38.6 MB 3.3 MB/s eta 0:00:01
--------------------------------------- 38.6/38.6 MB 3.3 MB/s eta 0:00:01
--------------------------------------- 38.6/38.6 MB 3.3 MB/s eta 0:00:01
--------------------------------------- 38.6/38.6 MB 3.3 MB/s eta 0:00:01
--------------------------------------- 38.6/38.6 MB 3.3 MB/s eta 0:00:01
---------------------------------------- 38.6/38.6 MB 3.0 MB/s eta 0:00:00
Installing collected packages: opencv-python
Successfully installed opencv-python-4.9.0.80
Note: you may need to restart the kernel to use updated packages.
In [1]:
#cv2 - computer vision
import cv2
img=cv2.imread('Kani.jpg')
cv2.imshow('Chairmakani',img)
cv2.waitKey()
cv2.destroyAllWindows()
In [11]:
#cv2 - computer vision
import cv2
img=cv2.imread('Kani.jpg')
cv2.imshow('Chairmakani',img)
cv2.waitKey(4000)
cv2.destroyAllWindows()
In [5]:
import numpy as np
import matplotlib.pyplot as plt
img=cv2.imread('Image1.jpg')
plt.imshow(img)
Out[5]:
<matplotlib.image.AxesImage at 0x25cd80daf90>
In [7]:
import numpy as np
import matplotlib.pyplot as plt
img=cv2.imread('sun.jpg')
plt.imshow(img)
plt.show()
In [13]:
#To change the image into gray image
import cv2
img=cv2.imread('sun.jpg')
#cvtColor - convert color image into grayscale image
img1=cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)
plt.imshow(img1)
plt.show()
In [15]:
#To change the image into gray image
import cv2
img=cv2.imread('sun.jpg')
#cvtColor - convert color image into grayscale image
img1=cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)
plt.imshow(img1,cmap='gray')
plt.show()
In [21]:
#To change the image into gray image
import cv2
img=cv2.imread('sun.jpg')
#cvtColor - convert color image into grayscale image
img1=cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)
plt.imshow(img1,cmap='winter') #autumn, bone,jet, winter, summer,spring
plt.show()
In [10]:
#To change the image into gray image
import cv2
img=cv2.imread('image.jpeg')
#cvtColor - convert color image into grayscale image
img1=cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)
plt.imshow(img1,cmap='summer')
plt.show()
In [11]:
#To change the image into gray image
import cv2
img=cv2.imread('image.jpeg')
#cvtColor - convert color image into grayscale image
img1=cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)
plt.imshow(img1,cmap='hot')
plt.show()
In [7]:
from skimage.io import imread,imshow
import matplotlib.pyplot as plt
image=imread('Kani.jpg')
imshow(image)
Out[7]:
<matplotlib.image.AxesImage at 0x20c62653f20>
In [9]:
from skimage.io import imread,imshow
import matplotlib.pyplot as plt
image=imread('Kani.jpg',as_gray=True)
imshow(image)
Out[9]:
<matplotlib.image.AxesImage at 0x20c62d59ca0>
In [1]:
import skimage
img=skimage.data.coins()
edges=skimage.filters.sobel(img)
skimage.io.imshow(edges)
skimage.io.show()
In [13]:
import skimage
img=skimage.data.astronaut()
edges=skimage.filters.sobel(img)
skimage.io.imshow(edges)
skimage.io.show()
In [3]:
from skimage.color import rgb2gray
import matplotlib.pyplot as plt
orig=skimage.data.astronaut()
gray=rgb2gray(orig)
fig,axes=plt.subplots(1,2,figsize=(8,4))
ax=axes.ravel()
ax[0].imshow(orig)
ax[0].set_title("Original")
ax[1].imshow(gray,cmap=plt.cm.gray)
ax[1].set_title("Gray Image")
fig.tight_layout()
plt.show()
In [4]:
from skimage.io import imread,imshow
import matplotlib.pyplot as plt
image=imread('tree.png',as_gray=False)
imshow(image)
Out[4]:
<matplotlib.image.AxesImage at 0x216c4692f10>
In [18]:
from skimage.color import rgb2gray
image=imread('Boys.JPG')
img=rgb2gray(image)
plt.subplot(121)
imshow(image)
plt.title('RGB Format')
plt.subplot(122)
imshow(img)
plt.title('Grayscale Format')
Out[18]:
Text(0.5, 1.0, 'Grayscale Format')
In [4]:
from skimage.transform import resize
image=imread('Boys.JPG')
resize=resize(image,(100,100))
plt.subplot(121)
imshow(image)
plt.title('Original Image')
plt.subplot(122)
imshow(resize)
plt.title('Resized Image')
Out[4]:
Text(0.5, 1.0, 'Resized Image')
In [5]:
#pillow - To Read the Image
from PIL import Image
img=Image.open('Dora.jpg')
img
Out[5]:
In [13]:
fig,axes=plt.subplots(4,5,figsize=(20,20))
ax=axes.ravel()
lfw_images=skimage.data.lfw_subset()
for i in range(20):
ax[i].imshow(lfw_images[90+i],cmap=plt.cm.gray)
ax[i].axis("off")
#fig.tight.layout()
plt.show()
In [9]:
fig,axes=plt.subplots(4,5,figsize=(20,20))
ax=axes.ravel()
lfw_images=skimage.data.lfw_subset()
for i in range(20):
ax[i].imshow(lfw_images[90+i])
ax[i].axis("off")
#fig.tight.layout()
plt.show()
In [25]:
from PIL import Image
img=Image.open('sun.jpg')
print(img.show())
img.save('D:\\DBMS\\kani.jpg')
im=img.resize((100,100))
print(im)
None <PIL.Image.Image image mode=RGB size=100x100 at 0x216549CF4D0>
In [14]:
img=Image.open('image.jpg')
crop=img.crop((150,180,230,230))
crop.show()
In [27]:
#To Change the image resolution using Pillow
img=Image.open('sun.jpg')
img.save('D:\\DBMS\\image3.jpg',quality=95)
In [16]:
#To Change the image resolution using Pillow
img=Image.open('Image1.jpg')
img.save('D:\\DBMS\\image4.jpg',quality=1)
In [31]:
from PIL import ImageFont
from PIL import ImageDraw
img=Image.open('kani.jpg')
draw=ImageDraw.Draw(img)
draw.text((10,100),'Good Morning',(59,57,55))
#img.save('D:\\DBMS\\Good.jpg')
img.show()
In [2]:
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
img=cv.imread('plot.png')
#assert img is not None, "File Could Not Be Read, Check with os.path.exits()"
kernal=np.ones((5,5),np.float32)/25
dst=cv.filter2D(img,-1,kernal)
plt.subplot(121),plt.imshow(img),plt.title('Original')
plt.xticks([]),plt.yticks([])
plt.subplot(122),plt.imshow(dst),plt.title('Filter Image')
plt.xticks([]),plt.yticks([])
plt.show()
In [4]:
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
img=cv.imread('kani5.jpg')
#assert img is not None, "File Could Not Be Read, Check with os.path.exits()"
kernal=np.ones((5,5),np.float32)/25
dst=cv.filter2D(img,-3,kernal)
plt.subplot(121),plt.imshow(img),plt.title('Original')
plt.xticks([]),plt.yticks([])
plt.subplot(122),plt.imshow(dst),plt.title('Filter Image')
plt.xticks([]),plt.yticks([])
plt.show()
In [5]:
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
img=cv.imread('sun.jpg')
dst=cv.blur(img,(15,15))
plt.subplot(121),plt.imshow(img),plt.title('Original')
plt.xticks([]),plt.yticks([])
plt.subplot(122),plt.imshow(dst),plt.title('Blur Image')
plt.xticks([]),plt.yticks([])
plt.show()
In [12]:
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
img=cv.imread('mission.jpg')
dst=cv.GaussianBlur(img,(5,5),0)
plt.subplot(121),plt.imshow(img),plt.title('Original')
plt.xticks([]),plt.yticks([])
plt.subplot(122),plt.imshow(dst),plt.title('Blur Image')
plt.xticks([]),plt.yticks([])
plt.show()
In [14]:
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
img=cv.imread('mission.jpg')
dst=cv.medianBlur(img,5)
plt.subplot(121),plt.imshow(img),plt.title('Original')
plt.xticks([]),plt.yticks([])
plt.subplot(122),plt.imshow(dst),plt.title('Blur Image')
plt.xticks([]),plt.yticks([])
plt.show()
In [17]:
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
img=cv.imread('kani5.jpg')
dst=cv.bilateralFilter(img,9,75,75)
plt.subplot(121),plt.imshow(img),plt.title('Original')
plt.xticks([]),plt.yticks([])
plt.subplot(122),plt.imshow(dst),plt.title('Blur Image')
plt.xticks([]),plt.yticks([])
plt.show()
In [9]:
import cv2
img=cv2.imread('sun.jpg')
im=cv2.copyMakeBorder(img,10,10,10,10,cv2.BORDER_CONSTANT,None,value=0)
cv2.imshow('Kani',im)
cv2.waitKey(8000)
cv2.destroyAllWindows()
In [11]:
import cv2
img=cv2.imread('sun.jpg')
im=cv2.line(img,(0,0),(500,500),color=(0,255,0),thickness=9)
cv2.imshow('Kani',im)
cv2.waitKey(5000)
cv2.destroyAllWindows()
In [1]:
import numpy as np
import cv2
img=np.zeros((512,512,3),dtype='uint8')
start_point=(100,100)
end_point=(450,450)
im=cv2.line(img,start_point,end_point,color=(255,250,255),thickness=9)
cv2.imshow('Drawing Line',im)
cv2.waitKey(5000)
cv2.destroyAllWindows()
In [3]:
from skimage import data
from skimage.color import rgb2hsv
import matplotlib.pyplot as plt
plt.figure(figsize=(15,15))
coffee = data.coffee()
plt.subplot(1,2,1)
plt.imshow(coffee)
plt.title("Original")
hsv = rgb2hsv(coffee)
plt.subplot(1,2,2)
color = plt.imshow(hsv)
plt.colorbar(color, fraction=0.046, pad=0.04) # ✅ pass mappable, not array
plt.title("HSV")
plt.show()
In [19]:
from skimage import data
from skimage import filters
from skimage.color import rgb2gray
import matplotlib.pyplot as plt
coffee=data.coffee()
gray=rgb2gray(coffee)
plt.figure(figsize=(15,15))
for i in range(10):
binary=(gray>i*0.1)*1
plt.subplot(5,2,i+1)
plt.title("Threshold:>"+str(round(i*0.1,1)))
plt.imshow(binary,cmap='gray')
plt.tight_layout()
In [13]:
# importing libraries
import cv2
# Create a VideoCapture object and read from input file
cap = cv2.VideoCapture('Home.mp4')
# Check if camera opened successfully
if (cap.isOpened()== False):
print("Error opening video file")
# Read until video is completed
while(cap.isOpened()):
# Capture frame-by-frame
ret, frame = cap.read()
if ret == True:
# Display the resulting frame
cv2.imshow('Frame', frame)
# Press Q on keyboard to exit
if cv2.waitKey(25) & 0xFF == ord('q'):
break
# Break the loop
else:
break
# When everything done, release the video capture object
cap.release()
# Closes all the frames
cv2.destroyAllWindows()
In [5]:
import cv2
# Open the default webcam (0)
cap = cv2.VideoCapture(0)
# Check if the webcam was opened successfully
if not cap.isOpened():
print("Error: Could not access the webcam.")
else:
print("Webcam accessed successfully!")
# Read the first frame to confirm capturing
ret, frame = cap.read()
if ret:
# Display the frame using imshow
cv2.imshow("Captured Frame", frame)
cv2.waitKey(0) # Wait for a key press to close the window
cv2.destroyAllWindows() # Close the window
else:
print("Error: Could not capture a frame.")
# Release the webcam
cap.release()
Webcam accessed successfully!
In [19]:
import cv2
# Open the image sequence
cap = cv2.VideoCapture("Kani.jpg")
# Check if the sequence was opened successfully
if not cap.isOpened():
print("Error: Could not open image sequence.")
else:
print("Image sequence opened successfully!")
# Read the first frame to confirm reading
ret, frame = cap.read()
if ret:
# Display the first frame using imshow
cv2.imshow("Captured Frame", frame)
cv2.waitKey(0) # Wait for a key press to close the window
cv2.destroyAllWindows() # Close the window
else:
print("Error: Could not read a frame from the sequence.")
# Release the capture object
cap.release()
Image sequence opened successfully!
In [15]:
import cv2
# Open the video file
cap = cv2.VideoCapture("Home.mp4")
# Check if the video was opened successfully
if not cap.isOpened():
print("Error: Could not open video file.")
else:
print("Video file opened successfully!")
# Get video properties (e.g., frame count and frame width)
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) # Get total number of frames in the video
fps = cap.get(cv2.CAP_PROP_FPS) # Get frames per second (FPS)
print(f"Total frames: {frame_count}, FPS: {fps}")
# Read and display each frame of the video
while True:
ret, frame = cap.read()
if not ret:
print("End of video or error occurred.")
break
# Display the frame
cv2.imshow("Video Frame", frame)
# Wait for 1ms for key press to continue or exit if 'q' is pressed
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Release the video capture object and close any OpenCV windows
cap.release()
cv2.destroyAllWindows()
Video file opened successfully! Total frames: 714, FPS: 59.94005994005994 End of video or error occurred.
In [21]:
import cv2
# Open the video file
cap = cv2.VideoCapture("Home.mp4")
# Check if the video was opened successfully
if not cap.isOpened():
print("Error: Could not open video file.")
exit()
# Get frame width and height
frame_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
frame_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc(*"XVID")
out = cv2.VideoWriter("output.avi", fourcc, 30.0, (frame_width, frame_height))
while True:
ret, frame = cap.read()
if not ret:
print("End of video or error occurred.")
break
# Write the frame to the output video file
out.write(frame)
# Display the frame
cv2.imshow("Frame", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Release everything
cap.release()
out.release()
cv2.destroyAllWindows()
OpenCV
To Capture and Save the video
In [17]:
import cv2
cap = cv2.VideoCapture(0)
result = cv2.VideoWriter('filename.mp4', cv2.VideoWriter_fourcc(*'MJPG'),30.0,
(int(cap.get(3)),int(cap.get(4))))
res = ''
while True:
success,img = cap.read()
if success == True:
if res=='START':
result.write(img)
cv2.imshow('Frame', img)
key = cv2.waitKey(1) & 0xFF
if key == ord('q'):
break
if key == ord('p'):
print('Pause')
res = 'PAUSE'
if key == ord('s'):
print('Start')
res = 'START'
else:
break
cap.release()
result.release()
cv2.destroyAllWindows()
Pause Start
In [ ]: